Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FPC compatibility #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix FPC compatibility #74

wants to merge 1 commit into from

Conversation

leledumbo
Copy link

These two files are QuickLogger's dependency, but they currently don't compile with FPC 3.2.X. This pull request attempts to fix that. Tested on 64-bit Linux.

{$IFNDEF FPC}
function SerializeStream(aObject : TObject) : TJSONValue;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've moved outside conditional because is fpc compatible

@@ -213,7 +213,9 @@ TJsonSerializer = class(TInterfacedObject,IJsonSerializer)
property UseNullStringsAsEmpty : Boolean read fUseNullStringsAsEmpty write fUseNullStringsAsEmpty;
function JsonToObject(aType : TClass; const aJson: string) : TObject; overload;
function JsonToObject(aObject : TObject; const aJson: string) : TObject; overload;
{$IFNDEF FPC}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've moved outside conditional because is fpc compatible

@@ -263,7 +263,9 @@ TDirItem = record
function FindDelimiter(const Delimiters, S: string; StartIdx: Integer = 1): Integer;
{$ENDIF}
function ConvertDateTimeToFileTime(const DateTime: TDateTime; const UseLocalTimeZone: Boolean): TFileTime;
{$ifdef mswindows}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to {IF DEFINED(DELPHIXE_UP) OR (DEFINED(FPC) AND DEFINED(MSWINDOWS))} because it's delphi crossplatform compatible

@@ -1309,8 +1311,10 @@ function GetFiles(const Path : string; Recursive : Boolean) : TArray<TDirItem>;
diritem.Name := rec.Name;
diritem.IsDirectory := False;
diritem.Size := rec.Size;
{$ifdef SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

diritem.CreationDate := ConvertFileTimeToDateTime(rec.FindData.ftCreationTime,True);
diritem.LastModified := ConvertFileTimeToDateTime(rec.FindData.ftLastWriteTime,True);
{$endif SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

@@ -1336,8 +1340,10 @@ procedure GetFiles(const Path : string; aAddToList : TDirItemAddProc; Recursive
diritem.Name := rec.Name;
diritem.IsDirectory := False;
diritem.Size := rec.Size;
{$ifdef SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

diritem.CreationDate := ConvertFileTimeToDateTime(rec.FindData.ftCreationTime,True);
diritem.LastModified := ConvertFileTimeToDateTime(rec.FindData.ftLastWriteTime,True);
{$endif SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

@@ -1363,8 +1369,10 @@ function GetDirectories(const Path : string; Recursive : Boolean) : TArray<TDirI
diritem.Name := rec.Name;
diritem.IsDirectory := True;
diritem.Size := rec.Size;
{$ifdef SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

diritem.CreationDate := ConvertFileTimeToDateTime(rec.FindData.ftCreationTime,True);
diritem.LastModified := ConvertFileTimeToDateTime(rec.FindData.ftLastWriteTime,True);
{$endif SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

@@ -1402,17 +1410,23 @@ function GetFilesAndDirectories(const Path : string; Recursive : Boolean) : TArr
diritem.Name := rec.Name;
diritem.IsDirectory := False;
diritem.Size := rec.Size;
{$ifdef SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

Result := Result + [diritem];
end
else if (rec.Name <> '.') and (rec.Name <> '..') then
begin
diritem.Name := rec.Name;
diritem.IsDirectory := True;
diritem.Size := rec.Size;
{$ifdef SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

@@ -1452,17 +1466,23 @@ procedure GetFilesAndDirectories(const Path : string; aAddToList : TDirItemAddPr
diritem.Name := rec.Name;
diritem.IsDirectory := False;
diritem.Size := rec.Size;
{$ifdef SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

aAddToList(diritem);
end
else if (rec.Name <> '.') and (rec.Name <> '..') then
begin
diritem.Name := rec.Name;
diritem.IsDirectory := True;
diritem.Size := rec.Size;
{$ifdef SEARCHREC_USEFINDDATA}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add FPC to conditional because this is a FPC only conditional

Copy link
Owner

@exilon exilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve and pull again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants